package com.sunhao.gulimall.search.controller;

import com.sunhao.gulimall.search.service.MallSearchService;
import com.sunhao.gulimall.search.vo.SearchParam;
import com.sunhao.gulimall.search.vo.SearchResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

/**
 * 描述：SearchController 类的用途
 * 日期：2024/12/1
 */
@Controller
public class SearchController {


    @Autowired
    MallSearchService mallSearchService;

    @GetMapping("/list.html")
    public String listPage(SearchParam param, Model model)
    {
        //根据前台传递的参数，到es中查询结果
        SearchResult result = mallSearchService.search(param);
        model.addAttribute("result",result);
        return "list";
    }
}
